package com.kb.mapper.es;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kb.entity.ComponentData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author 国创工软
 */

@Mapper
public interface ComponentDataMapper extends BaseMapper<ComponentData> {

    @Select("SELECT COUNT(1) FROM component_data " +
            "LEFT JOIN db_resources.organization ON component_data.org_id = organization.id " +
            "WHERE component_data.part_number = #{partNumber} " +
            "AND organization.organization_name = #{organizationName}")
    Integer selectCountByPartNumberAndOrgName(@Param("partNumber") String partNumber,
                                              @Param("organizationName") String organizationName);
}
